package com.share.innerclass;

/**
 * java 模拟实现多继承
 * @author Johnny Tam
 *
 */
public class PencilWithEraser {

	private MyPencil pencil = new MyPencil();
	private MyEraser eraser = new MyEraser();

	/**
	 * 
	 * 继承了铅笔的功能
	 * 
	 */
	private class MyPencil extends Pencil {
		@Override
		public void wirte() {
			System.out.println("use to wirte");
		}
	}

	/**
	 * 继承了橡皮擦的功能
	 */
	public class MyEraser extends Eraser {
		@Override
		public void erase() {
			System.out.println("use to erase");
		}
	}

	/**
	 * 本类自己的方法
	 */
	public void wirte() {
		pencil.wirte();
	}

	public void eraser() {
		eraser.erase();
	}
}
